<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>emp-toolkit: /Users/wangxiao/git/emp-toolkit/emp-tool/garble/block.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo-full-doxygen.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">emp-toolkit
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('garble_2block_8h.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">block.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;wmmintrin.h&gt;</code><br />
<code>#include &lt;emmintrin.h&gt;</code><br />
<code>#include &lt;xmmintrin.h&gt;</code><br />
<code>#include &lt;stdio.h&gt;</code><br />
</div>
<p><a href="garble_2block_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ad6447e1e625ffefda7dc7f4ef0c44be2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#ad6447e1e625ffefda7dc7f4ef0c44be2">garble_xor</a>(x,  y)&#160;&#160;&#160;_mm_xor_si128(x,y)</td></tr>
<tr class="separator:ad6447e1e625ffefda7dc7f4ef0c44be2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a689895f62eeb101fdda55f78eb64f321"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a689895f62eeb101fdda55f78eb64f321">garble_zero_block</a>()&#160;&#160;&#160;_mm_setzero_si128()</td></tr>
<tr class="separator:a689895f62eeb101fdda55f78eb64f321"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaba20a9be509e35b1ecaef329d3ce3fe"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#aaba20a9be509e35b1ecaef329d3ce3fe">garble_equal</a>(x,  y)&#160;&#160;&#160;(_mm_movemask_epi8(_mm_cmpeq_epi8(x,y)) == 0xffff)</td></tr>
<tr class="separator:aaba20a9be509e35b1ecaef329d3ce3fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0697b4b2d72c6b909475f470b97355b5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a0697b4b2d72c6b909475f470b97355b5">garble_unequal</a>(x,  y)&#160;&#160;&#160;(_mm_movemask_epi8(_mm_cmpeq_epi8(x,y)) != 0xffff)</td></tr>
<tr class="separator:a0697b4b2d72c6b909475f470b97355b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9417de4be4701bd27d52e89a0ceeac89"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a9417de4be4701bd27d52e89a0ceeac89">garble_lsb</a>(x)&#160;&#160;&#160;(*((char *) &amp;x) &amp; 1)</td></tr>
<tr class="separator:a9417de4be4701bd27d52e89a0ceeac89"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a877d2c3b464beb1bb40d5db7f71df6d9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a877d2c3b464beb1bb40d5db7f71df6d9">garble_make_block</a>(X,  Y)&#160;&#160;&#160;_mm_set_epi64((__m64)(X), (__m64)(Y))</td></tr>
<tr class="separator:a877d2c3b464beb1bb40d5db7f71df6d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5e8e50bd0f3c713be61a20f336e5b013"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a5e8e50bd0f3c713be61a20f336e5b013">garble_double</a>(B)&#160;&#160;&#160;_mm_slli_epi64(B,1)</td></tr>
<tr class="separator:a5e8e50bd0f3c713be61a20f336e5b013"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a65abbf31b0a30290189cdb5059b5f785"><td class="memItemLeft" align="right" valign="top">typedef __m128i&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a></td></tr>
<tr class="separator:a65abbf31b0a30290189cdb5059b5f785"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a9fb9a79c32958375aa8573e0bf37bcf6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a9fb9a79c32958375aa8573e0bf37bcf6">garble_seed</a> (<a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> *seed)</td></tr>
<tr class="separator:a9fb9a79c32958375aa8573e0bf37bcf6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a239be51068ea751dc159d331e9339360"><td class="memItemLeft" align="right" valign="top"><a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a239be51068ea751dc159d331e9339360">garble_random_block</a> (void)</td></tr>
<tr class="separator:a239be51068ea751dc159d331e9339360"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a895bc02edcaa0a0798728f538af35eb5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a895bc02edcaa0a0798728f538af35eb5">garble_allocate_blocks</a> (size_t nblocks)</td></tr>
<tr class="separator:a895bc02edcaa0a0798728f538af35eb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada4e63a00b5261d51014bef55489056c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#ada4e63a00b5261d51014bef55489056c">block_vfprintf</a> (FILE *stream, const char *format, va_list ap)</td></tr>
<tr class="separator:ada4e63a00b5261d51014bef55489056c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a05364853a9dfb7c2d9658d7d1a630b83"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a05364853a9dfb7c2d9658d7d1a630b83">block_fprintf</a> (FILE *stream, const char *format,...)</td></tr>
<tr class="separator:a05364853a9dfb7c2d9658d7d1a630b83"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a29c4a93cc8ef9c33505fc697e80f7ffd"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="garble_2block_8h.html#a29c4a93cc8ef9c33505fc697e80f7ffd">block_printf</a> (const char *format,...)</td></tr>
<tr class="separator:a29c4a93cc8ef9c33505fc697e80f7ffd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a5e8e50bd0f3c713be61a20f336e5b013"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5e8e50bd0f3c713be61a20f336e5b013">&sect;&nbsp;</a></span>garble_double</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define garble_double</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">B</td><td>)</td>
          <td>&#160;&#160;&#160;_mm_slli_epi64(B,1)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="aaba20a9be509e35b1ecaef329d3ce3fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaba20a9be509e35b1ecaef329d3ce3fe">&sect;&nbsp;</a></span>garble_equal</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define garble_equal</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">y&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(_mm_movemask_epi8(_mm_cmpeq_epi8(x,y)) == 0xffff)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a9417de4be4701bd27d52e89a0ceeac89"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9417de4be4701bd27d52e89a0ceeac89">&sect;&nbsp;</a></span>garble_lsb</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define garble_lsb</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x</td><td>)</td>
          <td>&#160;&#160;&#160;(*((char *) &amp;x) &amp; 1)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a877d2c3b464beb1bb40d5db7f71df6d9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a877d2c3b464beb1bb40d5db7f71df6d9">&sect;&nbsp;</a></span>garble_make_block</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define garble_make_block</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">X, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">Y&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;_mm_set_epi64((__m64)(X), (__m64)(Y))</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a0697b4b2d72c6b909475f470b97355b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0697b4b2d72c6b909475f470b97355b5">&sect;&nbsp;</a></span>garble_unequal</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define garble_unequal</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">y&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;(_mm_movemask_epi8(_mm_cmpeq_epi8(x,y)) != 0xffff)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ad6447e1e625ffefda7dc7f4ef0c44be2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad6447e1e625ffefda7dc7f4ef0c44be2">&sect;&nbsp;</a></span>garble_xor</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define garble_xor</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">y&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;_mm_xor_si128(x,y)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a689895f62eeb101fdda55f78eb64f321"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a689895f62eeb101fdda55f78eb64f321">&sect;&nbsp;</a></span>garble_zero_block</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define garble_zero_block</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;_mm_setzero_si128()</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="a65abbf31b0a30290189cdb5059b5f785"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a65abbf31b0a30290189cdb5059b5f785">&sect;&nbsp;</a></span>block</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef __m128i <a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a05364853a9dfb7c2d9658d7d1a630b83"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a05364853a9dfb7c2d9658d7d1a630b83">&sect;&nbsp;</a></span>block_fprintf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int block_fprintf </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a29c4a93cc8ef9c33505fc697e80f7ffd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a29c4a93cc8ef9c33505fc697e80f7ffd">&sect;&nbsp;</a></span>block_printf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int block_printf </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="ada4e63a00b5261d51014bef55489056c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ada4e63a00b5261d51014bef55489056c">&sect;&nbsp;</a></span>block_vfprintf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int block_vfprintf </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">va_list&#160;</td>
          <td class="paramname"><em>ap</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a895bc02edcaa0a0798728f538af35eb5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a895bc02edcaa0a0798728f538af35eb5">&sect;&nbsp;</a></span>garble_allocate_blocks()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>* garble_allocate_blocks </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nblocks</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a239be51068ea751dc159d331e9339360"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a239be51068ea751dc159d331e9339360">&sect;&nbsp;</a></span>garble_random_block()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> garble_random_block </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a9fb9a79c32958375aa8573e0bf37bcf6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9fb9a79c32958375aa8573e0bf37bcf6">&sect;&nbsp;</a></span>garble_seed()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> garble_seed </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> *&#160;</td>
          <td class="paramname"><em>seed</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_eec959d81771dc8b1a750b834e1341eb.html">emp-tool</a></li><li class="navelem"><a class="el" href="dir_c655749829cb727292045fefce142869.html">garble</a></li><li class="navelem"><a class="el" href="garble_2block_8h.html">block.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
  </ul>
</div>
</body>
</html>
